from bs4 import BeautifulSoup as bs
import json
import requests
from urllib import request,parse,error
url_string = r'http://www.baidu.com/index.html'
headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64)',
    'Host':'www.baidu.com'
}
header= {
    'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64)',
    'Host':'www.baidu.com'
}
req = requests.get(url_string,headers=header)
soup=bs(req.content,'html.parser')
print(soup.prettify())
for item in soup.find_all('a',class_='mnav'):
    print(item.string)
